package com.wondream.myframework.io;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

public class BufferedWriterTest {

    public static void main(String[] args) {
        BufferedWriter bw = null;
        try {
            File file = new File("./logs/buffered.txt");
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
            bw.write("你好，我是渣渣辉！");
            bw.newLine();
            bw.write("是兄弟就来砍我啊！");
            bw.flush();
        } catch (Exception e){

        } finally {
            try {
                if(bw!=null){
                    bw.close();
                    bw = null;
                }
            } catch (Exception e){}
        }
    }
}
